package com.xh.web.controller;

import java.util.List;

import com.xh.web.constant.AjaxResult;
import com.xh.web.domain.DProjectHis;
import com.xh.web.service.IDProjectHisService;
import com.xh.web.util.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 项目历史Controller
 * 
 * @author nxh
 * @date 2020-10-14
 */
@RestController
@RequestMapping("/db/his")
public class DProjectHisController extends BaseController
{
    @Autowired
    private IDProjectHisService dProjectHisService;

    /**
     * 查询项目历史列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DProjectHis dProjectHis)
    {
        startPage();
        List<DProjectHis> list = dProjectHisService.selectDProjectHisList(dProjectHis);
        return getDataTable(list);
    }

    /**
     * 导出项目历史列表
     */
    @GetMapping("/export")
    public AjaxResult export(DProjectHis dProjectHis)
    {
        /*List<DProjectHis> list = dProjectHisService.selectDProjectHisList(dProjectHis);
        ExcelUtil<DProjectHis> util = new ExcelUtil<DProjectHis>(DProjectHis.class);
        return util.exportExcel(list, "his");*/
        return null;
    }

    /**
     * 获取项目历史详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(dProjectHisService.selectDProjectHisById(id));
    }

    /**
     * 新增项目历史
     */
    @PostMapping
    public AjaxResult add(@RequestBody DProjectHis dProjectHis)
    {
        return toAjax(dProjectHisService.insertDProjectHis(dProjectHis));
    }

    /**
     * 修改项目历史
     */
    @PutMapping
    public AjaxResult edit(@RequestBody DProjectHis dProjectHis)
    {
        return toAjax(dProjectHisService.updateDProjectHis(dProjectHis));
    }

    /**
     * 删除项目历史
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(dProjectHisService.deleteDProjectHisByIds(ids));
    }
}
